import java.util.Arrays;

/**
 * Created with IntelliJ IDEA
 * Description
 * User:user
 * Date:2021-10-20
 * Time:17:43
 */

//给定整型数组, 把所有的偶数放到数组前面, 把所有奇数放到数组后面.


/*
public class HomeWork2 {
    public static void fun(int[] arry){
        int i = 0;
        int j = arry.length - 1;
        while(i < j){
            while(i <j && arry[i] % 2 == 0){
                i++;
            }
            while(j > i && arry[j] % 2 != 0){
                j--;
            }
            int tmp = arry[i];
            arry[i] = arry[j];
            arry[j] = tmp;
        }
    }
    public static void main(String[] args) {
        int[] arry = {3,5,7,9,4,6,8};
        fun(arry);
        System.out.println(Arrays.toString(arry));

    }
}
*/
//给定两个整型数组, 交换两个数组的内容.
public class HomeWork2{
    public static void swap(int[] arry1,int[] arry2){
        for (int i = 0; i < arry1.length; i++) {
            int tmp = arry1[i];
            arry1[i] = arry2[i];
            arry2[i] = tmp;
        }
    }
    public static void main(String[] args) {
        int[] arry1 = {1,2,3};
        int[] arry2 = {4,5,6};
        swap(arry1,arry2);
        System.out.println(Arrays.toString(arry1));
        System.out.println(Arrays.toString(arry2));
    }
}




























